#coding:utf-8
from flask import Flask as fl
from flask_mail import Mail,Message
import os
app = fl(__name__)
app.config['MAIL_SERVER']='smtp.qq.com'
app.config['MAIL_PORT'] = 25
app.config['MAIL_USE_TLS'] = True
app.config['MAIL_USERNAME'] = os.environ.get('MAIL_USERNAME') or '1084540622@qq.com'  #发送者
app.config['MAIL_PASSWORD'] = os.environ.get('MAIL_PASSWORD') or 'ipwdpxekalrlgaaa'   #smtp验证码

mail = Mail(app)

@app.route('/')
def index():
    
    #1):标题 sender:发送者 recipients:接受者
    # html:发送内容
    # 发送附件或图片参考：http://blog.csdn.net/werewolf_st/article/details/46805429  
    
    msg = Message('hi',sender='1084540622@qq.com',recipients=['506535141@qq.com','xinchao3213@163.com'])
    msg.html = '<b>hello </b>'
    mail.send(msg)
    return '<h4>ok!</h4>'

if __name__ == '__main__':
        app.run(host='127.0.0.1',debug=True)    
